import Taro from '@tarojs/taro'
import {STORAGE_KEY} from "./const";


export default {

  getWeiXinId(){
    //修改weixinId时 还要去project.config.json中修改

    // return 'wx8bd0970ccb7d847c';//茶陵weixinId
    // return 'wxd900135399d785b1';//汨罗weixinId
    return Taro.getStorageSync(STORAGE_KEY.WEIXIN_ID);

  },

  getToken(){
    let token = Taro.getStorageSync(STORAGE_KEY.TOKEN);
    return token;
  },

  getMobile(){
    let mobile = Taro.getStorageSync(STORAGE_KEY.MOBILE);
    return mobile;
  },

  getIsBindMobile(){
    let isBindMobile = Taro.getStorageSync(STORAGE_KEY.IS_BIND_MOBILE);
    return isBindMobile;
  },

  getIsBindWechat(){
    let isBindWechat = Taro.getStorageSync(STORAGE_KEY.IS_BIND_WECHAT);
    return isBindWechat;
  },

  getIsBusiness(){
    let isBusiness = Taro.getStorageSync(STORAGE_KEY.IS_BUSINESS);
    return isBusiness;
  } ,
  getAuthInfo(){

    return {weixinId:this.getWeiXinId(),appId:'KC876D98B30UA40CJSNHI689FB33SDW',digest:'dda484557c12febe48139d8f44051c13',token: this.getToken()}

  },

  getAddressName(){
    let addressName = Taro.getStorageSync(STORAGE_KEY.ADDRESS_NAME);
    return addressName;
  },

  getBusinessMobile(){
    let businessMobile = Taro.getStorageSync(STORAGE_KEY.BUSINESS_MOBILE);
    return businessMobile;
  },

  getProxyMobile(){
    let proxyMobile = Taro.getStorageSync(STORAGE_KEY.PROXY_MOBILE);
    return proxyMobile ? proxyMobile : '';
  },

  getProxyWeixinCode(){
    let proxyWeixinCode = Taro.getStorageSync(STORAGE_KEY.PROXY_WEIXIN_CODE);
    return proxyWeixinCode ? proxyWeixinCode :'';
  },

  getHasAuth(){
    let hasAuth = Taro.getStorageSync(STORAGE_KEY.HAS_AUTH);
    return hasAuth;
  },

  getWeiXinNickname(){
    return Taro.getStorageSync(STORAGE_KEY.WEIXIN_NICKNAME);
  },

  getWeiXinAvatar(){
    return Taro.getStorageSync(STORAGE_KEY.WEIXIN_AVATAR);
  },

  getUserId(){
    return Taro.getStorageSync(STORAGE_KEY.USER_ID);
  },

  getShareUserId(){
    return Taro.getStorageSync(STORAGE_KEY.SHARE_USER_ID);
  },

  getOpenId(){
    return Taro.getStorageSync(STORAGE_KEY.OPEN_ID);
  },

  getHasShowAd(){
    let showAd = false;

    //新版只有这一个小程序了  所以均需要显示广告

    // if (this.getWeiXinId() == 'wx8bd0970ccb7d847c') { // 目前只有茶陵小程序开通了广告
      showAd = true;
    // }
    return showAd;
  },

  getAreaName(){
    return Taro.getStorageSync(STORAGE_KEY.AREA_NAME);
  },
}
